% This function computes the variance of x due to the specified shocks
% 
% Syntax:
% 
% vard = vardec(Fmat,C,horizon,shock)
% 
% where:      Fmat:  companion matrix 
%             C:  Cholesky factorization matrix
%             lam: estimated parameters in the observation equation
%             horizon: horizon for the variance computation
%             shock: vector with the shocks

function vard=vardec(Fmat,C,horizon,shock);

ii=diag(shock);

Omega=C*ii*C';     % Need to change this line for policy shock only

vard=Omega;
for i=1:horizon;
    vard=vard+Fmat(1:size(C,1),1:size(C,2))*Omega*Fmat(1:size(C,1),1:size(C,2))';
    Fmat=Fmat*Fmat;
end

